<template>
	<div class="main">
		<div class="adOuterWrap">
			<div class="back">
				<!-- <go-back aa='../evaluation/evaluationEntry'></go-back> -->
				<headerBack></headerBack>
				<h2>报告记录</h2>

			</div>
			<div class="adWrap">
				<scroller style="top: 1.6rem;">
					<div>
						<div class="adBoxs">
							<div class="listBox" v-for="(item,index) in sinDatas" :key='index' @click="goesResu(item)">
								<div class="recordList">
									<div class="record1 flex-h">
										<span class="sp1 flex1">{{typer==1?'职业兴趣测试':typer==2?'多元智能测试':typer==3?'职业价值观测试':typer==4?' MBTI性格测试':'成长环境测试'}}</span>
										<span class="sp2">第{{lens-index}}次生成</span>
									</div>
									<div class="record2 flex-h">
										<span class="sp1 flex1">测试时间</span>
										<span class="sp2">{{(new Date(item.createTime)).format('yyyy-MM-dd hh:mm')}}</span>
										<span class="sp3">
											<img src="~/static/iconsvgs/rightsy.png" alt="">
										</span>
									</div>
									<div class="record2 flex-h">
										<span class="sp1 flex1">测试结论</span>
										<span class="sp2">{{item.character.length>1?item.character[0]+'(多结果)':item.character[0]}}</span>
									</div>
								</div>
							</div>


						</div>
						<div style="width: 100%;height: 1.6rem;"></div>
					</div>

				</scroller>
			</div>

		</div>
	</div>
</template>
<script>
	import ls from 'store2';
	import {
		format
	} from '~/plugins/filter';
	import headerBack from '~/components/headerBack'
	import reportList from '~/components/reportList'
	import {getReport} from '~/api/evaluation'
	export default {
		head: {
			title: '生涯测评'
		},
		components: {
			headerBack,
			reportList
		},
		data() {
			return {
				sinDatas: [],
				flag: false,
				typer: 0,
				lens:1
			}
		},
		created() {
	
			let aa = ls.get('testTypes') * 1;
			switch (aa) {
				case 1:
					this.typer = 1
					break;
				case 2:
					this.typer = 3
					break;
				case 3:
					this.typer = 4
					break;
				case 4:
					this.typer = 2
					break;
				case 5:
					this.typer = 5
					break;
				default:
					break;
			}

			this.getReport();
		},
		mounted: function() {},			
		watch: {

		},
		methods: {
			goesResu(item) {
				let sxr;
				switch (item.type) {
					case 1:
						sxr = 1
						break;
					case 2:
						sxr = 4
						break;
					case 3:
						sxr = 2
						break;
					case 4:
						sxr = 3
						break;
					case 5:
						sxr = 5
						break;
					default:
						break;
				}
				let arrs = JSON.parse(item.characterSet);
				let obj = {
					status: sxr,
					worthScore: arrs,
 
				}		 
				ls.set('resultPar', obj)
				ls.set('preUrl','../evaluation/singleRecord')
				this.commonJs.gopush('chiResult')
			},
			getReport() {
				this.$vux.loading.show()
				getReport(this.typer,ls.get('userType')).then(res => {
					if (res.code === '0') {
						let are = res.data;
						 are.forEach((item)=>{
							item.character = item.character.split("+")
						})
						
						this.sinDatas = are;
		
						this.lens=res.data.length;
					}
					this.$vux.loading.hide()
				}).catch(() => {
			
					this.$vux.loading.hide()
				})
			},
		}
	}
</script>

<style scoped lang="less">
	.adOuterWrap {
		width: 7.5rem;
		height: 100vh;
		background: #fff;
		flex-direction: column;
		overflow: hidden;

		.adWrap {

			padding: 0 0.3rem;
			width: 7.5rem;
			box-sizing: border-box;

			.adBoxs {
				width: 100%;
				height: auto;

				.listBox {
					height: auto;
					padding: 0.1rem 0.3rem;
					box-sizing: border-box;
					overflow: hidden;


				}


			}
		}


	}

	.back {
		width: 100%;
		height: auto;

		h2 {
			padding: 0 0.3rem;
			box-sizing: border-box;
			display: block;
			height: 0.8rem;
			font-size: 0.44rem;

			font-weight: bold;
			color: rgba(34, 34, 34, 1);
			line-height: 0.8rem;
		}
	}

	.recordList {
		margin-top: 0.3rem;
		width: 100%;
		height: 2.5rem;
		box-shadow: 0px 0px 0.2rem 0px rgba(204, 204, 204, 0.3);
		border-radius: 0.1rem;
		border: 0.02rem solid rgba(238, 238, 238, 1);
		padding: 0.2rem 0.3rem;
		box-sizing: border-box;

		.record1 {
			height: 0.5rem;
			line-height: 0.5rem;

			.sp1 {
				font-size: 0.3rem;
				font-weight: bold;
				color: rgba(34, 34, 34, 1);
			}

			.sp2 {
				width: 1.9rem;
				height: 0.5rem;
				background: rgba(250, 250, 250, 1);
				border-radius: 0.25rem;
				font-size: 0.24rem;
				font-weight: bold;
				color: rgba(187, 187, 187, 1);
				line-height: 0.5rem;
				text-align: center;
			}
		}

		.record2 {
			height: 0.5rem;
			line-height: 0.5rem;
			margin-top: 0.2rem;

			.sp2 {
				flex: 2
			}

			.sp1,
			.sp2 {
				font-size: 0.26rem;
				// font-family:PingFang-SC-Medium;
				font-weight: 500;
				color: rgba(153, 153, 153, 1);
				// line-height:37px;
			}

			.sp3 {
				width: 0.3rem;

				img {
					width: 0.2rem;
					height: auto;
				}
			}
		}

	}
</style>
